x86/mm: Refactor put_page_from_l*e to reduce code duplication
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 13 Dec 2019 12:53:04 +0000 (12:53 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 13 Dec 2019 17:15:52 +0000 (17:15 +0000)
commitcca2eac887c64f69b3a7662e2cc6911db097c846
tree2d2e41e0309e4e067ca9f5288425d5b63015823d
parentd25482b2f6382e8518657181198aa2201e52c326
x86/mm: Refactor put_page_from_l*e to reduce code duplication

put_page_from_l[234]e have identical functionality for devalidating an
entry pointing to a pagetable.  But mystifyingly, they duplicate the
code in slightly different arrangements that make it hard to tell that
it's the same.

Create a new function, put_pt_page(), which handles the common
functionality; and refactor all the functions to be symmetric,
differing only in the level of pagetable expected (and in whether they
handle superpages).

Other than put_page_from_l2e() gaining an ASSERT it probably should
have had already, no functional changes.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c